package question2;

public class Course {
    private String name;
    private College college;
    private Building building; // 约束：Course一定在某个Building中进行

    public Course(String name, College college, Building building) {
        this.name = name;
        this.college = college;
        this.building = building;
    }

    public String getName() {
        return name;
    }

    public College getCollege() {
        return college;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setCollege(College college) {
        this.college = college;
        college.addCourse(this);    // 反向关联学院
    }

    public Building getBuilding() {
        return building;
    }

    public void setBuilding(Building building) {
        this.building = building;
    }
}
